home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 86
/
(Vol 86) My Disc.iso
/
Games
/
restaurante_1072.swf
/
scripts
/
__Packages
/
Mission.as
< prev
next >
Wrap
Text File
|
2009-04-16
|
19KB
|
504 lines
if(true)
{
if(true)
{
§§push(false);
}
if(!§§pop())
{
if(true)
{
if(true)
{
§§push(false);
}
if(!§§pop())
{
if(!_global.Mission)
{
var _loc2_ = _global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.prototype;
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.__get__totalCashes = function()
{
var _loc2_ = 0;
var _loc1_ = 0;
while(_loc1_ < MissionData.DATA.length)
{
_loc2_ += MissionData.DATA[_loc1_].cash;
_loc1_ = _loc1_ + 1;
}
return _loc2_;
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.getMission = function()
{
if(Mission._missionObj == null)
{
trace("没有获取到Mission,对象为Null");
return null;
}
return Mission._missionObj;
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.terminateCurrent = function()
{
if(Mission._missionObj != null)
{
Mission._missionObj.terminate();
}
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.createMission = function($id, $mc)
{
if($id == undefined)
{
$id = 0;
}
if($mc == undefined)
{
trace("严重错误:创建Mission时没有找到需要的MovieClip");
return null;
}
Mission.current = $id;
Mission._missionObj = new Mission($id,$mc);
return Mission._missionObj;
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.missionAgain = function()
{
Mission.root.gotoAndStop("missionSwitch");
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.nextMission = function()
{
if(Mission._missionObj.__get__id() >= Mission.MAXLEVEL)
{
Mission.allComplete();
}
else
{
Mission.root.gotoAndStop(Mission._missionObj.__get__id() + 3);
}
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.allComplete = function()
{
Mission.root.gotoAndStop("end");
};
_loc2_.refreshDepth = function()
{
function sortFunction(a, b)
{
if(a._y > b._y)
{
return 1;
}
if(a._y < b._y)
{
return -1;
}
if(a._x > b._x)
{
return 1;
}
return -1;
}
var _loc3_ = [this.__get__waitress().__get__mc()];
var _loc2_ = 0;
while(_loc2_ < this.__get__tables().length)
{
_loc3_.push(this.__get__tables()[_loc2_].mc);
_loc2_ = _loc2_ + 1;
}
_loc3_.sort(sortFunction);
_loc3_.push(this.__get__door().__get__mc());
if(this.draggingMc)
{
_loc3_.push(this.draggingMc);
}
if(this.ui)
{
_loc3_.push(this.ui);
}
_loc2_ = 0;
while(_loc2_ < _loc3_.length)
{
_loc3_[_loc2_].swapDepths(this.__get__mc().getNextHighestDepth());
_loc2_ = _loc2_ + 1;
}
};
_loc2_.checkEnd = function()
{
if(this.__get__isEmpty())
{
this.missionOver();
}
};
_loc2_.tableCustomersLeave = function(t)
{
if(t.__get__isLove())
{
this.numLoves = this.numLoves + 1;
}
this.cashes += t.cashes;
if(this.numLoves >= 2)
{
if(!this.boundHeart)
{
this.boundAll(1);
this.boundHeart = true;
}
}
if(this.__get__isEmpty())
{
this.missionOver();
}
};
_loc2_.terminate = function()
{
this.terminated = true;
if(this.__get__waitress().tween != null)
{
this.__get__waitress().tween.stop();
this.__get__waitress().tween = null;
}
this.__get__waitress().__get__mc()._visible = false;
if(this.candle)
{
this.candle.__get__mc().onPress = null;
}
this.createCandle = function()
{
trace("Mission is terminated, Don\'t create candle");
};
if(this.harp)
{
this.harp.__get__mc().onRelease = null;
}
this.__get__door().stopAddCustomer();
var _loc2_ = 0;
while(_loc2_ < this.__get__tables().length)
{
Table(this.__get__tables()[_loc2_]).__set__status(Table.NOTFULL);
_loc2_ = _loc2_ + 1;
}
trace("mission" + this.__get__id() + " terminated");
};
_loc2_.initMission = function()
{
this._tables = [];
this._door = new Door(this.__get__mc()[this.data.door.mcName]);
this._waitress = new Waitress(this.__get__mc()[this.data.waitress.mcName]);
this._kitchen = new Kitchen(this.__get__mc()[this.data.kitchen.mcName],this.data.kitchen);
var _loc2_ = 0;
while(_loc2_ < this.data.tables.length)
{
var _loc3_ = this.data.tables[_loc2_];
this._tables.push(new Table(this.__get__mc()[_loc3_.mcName],_loc3_));
_loc2_ = _loc2_ + 1;
}
if(MissionData.DATA[this.__get__id()].candle)
{
this.createCandle();
}
if(this.harp == null && MissionData.DATA[this.__get__id()].harp)
{
this.harp = BoundItem.getHarp(this.__get__door().__get__mc(),{_x:-10,_y:-30});
}
this.refreshDepth();
};
_loc2_.boundAll = function(numHearts)
{
trace("bound for all: +" + numHearts);
var _loc4_ = this.__get__door().__get__customersArray().concat();
var _loc3_ = 0;
while(_loc3_ < this.__get__tables().length)
{
var _loc2_ = 0;
while(_loc2_ < Table(this.__get__tables()[_loc3_]).__get__customersArray().length)
{
_loc4_.push(this.__get__tables()[_loc3_].customersArray[_loc2_]);
_loc2_ = _loc2_ + 1;
}
_loc3_ = _loc3_ + 1;
}
_loc3_ = 0;
while(_loc3_ < _loc4_.length)
{
Customer(_loc4_[_loc3_]).changeHearts(numHearts);
_loc3_ = _loc3_ + 1;
}
_loc4_ = [];
};
_loc2_.getBound = function(bound)
{
switch(bound)
{
case this.candle:
trace("bound for " + bound.__get__table() + ": +" + bound.__get__heartsNum());
var _loc2_ = 0;
while(_loc2_ < bound.__get__table().__get__numCustomers())
{
bound.__get__table().__get__customersArray()[_loc2_].changeHearts(bound.__get__heartsNum());
_loc2_ = _loc2_ + 1;
}
this.createCandle();
break;
case this.harp:
_loc2_ = 0;
while(_loc2_ < this.__get__door().__get__customersArray().length)
{
var _loc4_ = Customer(this.__get__door().__get__customersArray()[_loc2_]);
_loc4_.changeHearts(bound.__get__heartsNum());
_loc2_ = _loc2_ + 1;
}
}
};
_loc2_.createCandle = function()
{
var _loc2_ = Math.random() * 20000 + 10000;
var obj = this;
var interval = setInterval(function()
{
if(!obj.terminated)
{
obj.candle = BoundItem.getCandle(obj.__get__mc(),{_x:obj.__get__kitchen().__get__mc()._x - 100,_y:obj.__get__kitchen().__get__mc()._y + 30});
}
clearInterval(interval);
}
,_loc2_);
};
_loc2_.toString = function()
{
return "Mission " + this.__get__id();
};
_loc2_.__get__happyTablesNum = function()
{
return this._happyTablesNum;
};
_loc2_.__get__kitchen = function()
{
return this._kitchen;
};
_loc2_.__get__waitress = function()
{
return this._waitress;
};
_loc2_.__get__isEmpty = function()
{
var _loc2_ = 0;
while(_loc2_ < this.__get__tables().length)
{
if(!Table(this.__get__tables()[_loc2_]).__get__isEmpty())
{
return false;
}
_loc2_ = _loc2_ + 1;
}
return this.__get__door().__get__isEmpty();
};
_loc2_.__get__door = function()
{
return this._door;
};
_loc2_.__get__id = function()
{
return this._id;
};
_loc2_.__get__mc = function()
{
return this._mc;
};
_loc2_.__get__tables = function()
{
return this._tables;
};
_loc2_.missionOver = function()
{
MissionData.DATA[this.__get__id()].cash = this.cashes;
if(this.passLimit > this.numLoves)
{
this.fail();
}
else
{
this.pass();
}
this.terminate();
};
_loc2_.fail = function()
{
this.ui = this.__get__mc().attachMovie("UI","ui",this.__get__mc().getNextHighestDepth());
this.ui.gotoAndStop("fail");
this.ui.loves_txt.text = this.numLoves;
this.ui.cash_txt.text = this.cashes;
this.ui.again_btn.onRelease = function()
{
Mission.missionAgain();
};
};
_loc2_.pass = function()
{
this.ui = this.__get__mc().attachMovie("UI","ui",this.__get__mc().getNextHighestDepth());
this.ui.gotoAndStop("pass");
this.ui.loves_txt.text = this.numLoves;
this.ui.cash_txt.text = this.cashes;
this.ui.again_btn.onRelease = function()
{
Mission.missionAgain();
};
this.ui.next_btn.onRelease = function()
{
Mission.nextMission();
};
};
_loc2_.statusChangedHandle = function(event)
{
if(event.target.CLASS === Customer)
{
this.customerStatusHandle(event.status);
}
};
_loc2_.customerStatusHandle = function(s)
{
if(s !== Customer.SIT)
{
}
};
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}._missionObj = null;
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.root = null;
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.current = 0;
_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.MAXLEVEL = 2;
_loc2_._id = 0;
_loc2_._happyTablesNum = 0;
_loc2_.draggingMc = null;
_loc2_.numLoves = 0;
_loc2_.passLimit = 2;
_loc2_.cashes = 0;
_loc2_.ui = null;
_loc2_.boundHeart = false;
_loc2_.harp = null;
_loc2_.candle = null;
§§push(_loc2_.addProperty("door",_loc2_.__get__door,function()
{
}
));
§§push(_loc2_.addProperty("happyTablesNum",_loc2_.__get__happyTablesNum,function()
{
}
));
§§push(_loc2_.addProperty("id",_loc2_.__get__id,function()
{
}
));
§§push(_loc2_.addProperty("isEmpty",_loc2_.__get__isEmpty,function()
{
}
));
§§push(_loc2_.addProperty("kitchen",_loc2_.__get__kitchen,function()
{
}
));
§§push(_loc2_.addProperty("mc",_loc2_.__get__mc,function()
{
}
));
§§push(_loc2_.addProperty("tables",_loc2_.__get__tables,function()
{
}
));
§§push((_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}).addProperty("totalCashes",_global.Mission = function($id, $mc)
{
this._id = $id;
this._mc = $mc;
this.terminated = false;
this.data = MissionData.DATA[this.__get__id()];
}.__get__totalCashes,function()
{
}
));
§§push(_loc2_.addProperty("waitress",_loc2_.__get__waitress,function()
{
}
));
§§push(ASSetPropFlags(_global.Mission.prototype,null,1));
}
§§pop();
}
}
§§goto(addr1195);
}
}
addr1195: